#!/usr/bin/env python

VERSION='0.1'
APPNAME='gameobject'

srcdir = '.'
blddir = 'build'

import sys, os
import waf_dynamo, waf_ddf
import waflib.Options
import TestContext

test_context = None

def init(ctx):
    global test_context
    if 'build' in waflib.Options.commands:
        test_context = TestContext.create_test_context()

def options(opt):
    opt.recurse('src')
    opt.load('waf_dynamo')

def configure(conf):
    conf.load('waf_dynamo')
    conf.load('java')
    waf_ddf.configure(conf)

    conf.recurse('src')

    conf.env.append_value('INCLUDES', 'src')
    conf.env.append_value('INCLUDES', 'src/proto')
    conf.env['STLIB_DLIB']      = ['dlib', 'mbedtls', 'zip']
    conf.env['STLIB_DDF']       = 'ddf'
    conf.env['STLIB_RIG']       = 'rig'
    conf.env['STLIB_RESOURCE']  = 'resource'
    conf.env['STLIB_SCRIPT']    = 'script'
    conf.env['STLIB_EXTENSION'] = 'extension'

    conf.env.append_unique('DEFINES', 'DLIB_LOG_DOMAIN="GAMEOBJECT"')

def build(bld):
    global test_context

    sys.path.insert(0, os.path.abspath('build/proto'))
    sys.path.insert(0, os.path.abspath('build/proto/gameobject'))

    bld.recurse('src')
    TestContext.initialize_test_context(test_context, bld)

def shutdown(self):
    waf_dynamo.run_tests(test_context, valgrind = True)
